package com.woniu.service.impl;

import com.woniu.dao.CourseInfoDao;
import com.woniu.entity.Course;
import com.woniu.entity.User;
import com.woniu.entity.Vedio;
import com.woniu.entity.vo.Information;
import com.woniu.service.CourseInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseInfoServiceImpl implements CourseInfoService {
    @Autowired
    public CourseInfoDao courseInfoDao;
    //  TODO: 2023/10/23 所有课程信息查询
    @Override
    public List<Vedio> queryCourseInfo(Integer id) {
        List<Vedio> vedios = courseInfoDao.queryCourseInfo(id);
        return vedios;
    }
//查询所有课程信息
    @Override
    public Course selectCourseInfo(Integer id) {
        Course course = courseInfoDao.selectCourseInfo(id);
        return course;
    }

    /**
     * 修改课程信息
     * @param information
     */
    @Override
    public void amend(Information information) {
        courseInfoDao.amend(information);
    }

    /**
     * 下架操作
     * @param id
     */
    @Override
    public void SoldOut(Integer id) {
        courseInfoDao.SoldOut(id);
    }

    /**
     * 删除操作
     * @param id
     */
    @Override
    public void Delect(Integer id) {
        courseInfoDao.Delect(id);
    }

    /**
     * 根据课程id查询学员信息
     * @param id
     */
    @Override
    public List<User> QueryUser(Integer id) {
        List<User> users = courseInfoDao.QueryUser(id);
        return users;

    }

    /**
     * 上架课程
     * @param id
     */
    @Override
    public void ShelvingOperation(Integer id) {
        courseInfoDao.ShelvingOperation(id);

    }
//查询课程视频
    @Override
    public Integer selectVideoUrl(String id, String name) {
        return courseInfoDao.selectVideoUrl(id, name);
    }
//添加视频
    @Override
    public void addvideoUrl(Information information) {
        courseInfoDao.addvideoUrl(information);

    }
//删除视频
    @Override
    public void DelectID(Integer id) {
        courseInfoDao.DelectID(id);
    }
}
